package com.culturesalon.servlet;

import java.io.IOException;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.culturesalon.dao.OrderItemDAO;
import com.culturesalon.dao.OrderItemDAOImpl;
import com.culturesalon.dao.OrdersDAO;
import com.culturesalon.dao.OrdersDAOImpl;
import com.culturesalon.dto.Goods;
import com.culturesalon.dto.OrderItem;
import com.culturesalon.dto.Orders;
import com.culturesalon.dto.User;
import com.culturesalon.util.OrderState;
import com.culturesalon.util.PaymentWay;

/**
 * Servlet implementation class OrdersList
 */
@WebServlet("/orderslist.do")
public class OrdersList extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public OrdersList() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		//String orderId = String.valueOf(new Date().getTime());
		//String id=request.getParameter("id");
		OrdersDAO ordersDAO=new OrdersDAOImpl();
		//Orders orders=ordersDAO.get(Integer.parseInt(id));	
		List<Orders> list=ordersDAO.findAll();
		
		request.setAttribute("orders", list);
		request.setAttribute("mainpage", "ordergeneration.jsp");
		//request.setAttribute("orderItemList", orderItemList);
		//request.getRequestDispatcher("admin/ordergeneration.jsp").forward(request, response);
		request.getRequestDispatcher("admin/adminindex.jsp").forward(request, response);




		

	}

}
